package com.xoa.controller.hr.learningExperience;

import com.xoa.model.hr.learningExperience.LearningExperienceWithBLOBs;
import com.xoa.service.hr.learningExperience.LearningExperienceService;
import com.xoa.util.common.wrapper.BaseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("learningExperience")
public class LearningExperienceControllr {
    @Autowired
    LearningExperienceService learningExperienceService;

    /**
    * @author 程叶同
    * @date 2018/7/2 10:59
    * @desc  导航栏
    */
    @RequestMapping("/navigationBar")
    public String navigationBar(){
        return "app/hr/learningExperience/navigationBar";
    }

    @RequestMapping("/LearningExperienceImport")
    public String LearningExperienceImport(){
        return "app/hr/learningExperience/LearningExperienceImport";
    }

    @RequestMapping("/LearningExperienceManager")
    public String LearningExperienceManager(){
        return "app/hr/learningExperience/LearningExperienceManager";
    }

    @RequestMapping("/LearningExperienceQuery")
    public String LearningExperienceQuery(){
        return "app/hr/learningExperience/LearningExperienceQuery";
    }

    @RequestMapping("/newLearningExperience")
    public String newLearningExperience(){
        return "app/hr/learningExperience/newLearningExperience";
    }

    @RequestMapping("/learningExperienceDetail")
    public String learningExperienceDetail(){
        return "app/hr/learningExperience/learningExperienceDetail";
    }

    @RequestMapping("/learningExperienceDetail2")
    public String learningExperienceDetaisl(){
        return "app/hr/learningExperience/learningExperienceDetail2";
    }

    //功能业务
    @RequestMapping("/createLearningExperience")
    @ResponseBody
    public BaseWrapper newLearningExperience(LearningExperienceWithBLOBs learningExperienceWithBLOBs){
        return learningExperienceService.newLearningExperience(learningExperienceWithBLOBs);
    }

    @RequestMapping("/getLerningExperienceById")
    @ResponseBody
    public BaseWrapper getLerningExperienceById(HttpServletRequest request,Integer id){
        return learningExperienceService.getLerningExperienceById(request,id);
    }

    @RequestMapping("/updateLearningExperience")
    @ResponseBody
    public BaseWrapper updateLearningExperience(LearningExperienceWithBLOBs learningExperienceWithBLOBs){
        return learningExperienceService.updateLearningExperience(learningExperienceWithBLOBs);
    }

    @RequestMapping("/getLearningExperienceList")
    @ResponseBody
    public BaseWrapper getLearningExperienceList(HttpServletRequest request,Integer page,Integer pageSize,boolean useFlag,LearningExperienceWithBLOBs learningExperienceWithBLOBs){
        return learningExperienceService.getLearningExperienceList(request,page,pageSize,useFlag,learningExperienceWithBLOBs);
    }


    @RequestMapping("/deleteLearningExperienceByIds")
    @ResponseBody
    public BaseWrapper deleteLearningExperienceByIds(@RequestParam("ids[]") Integer[] ids){
        return learningExperienceService.deleteLearningExperienceByIds(ids);
    }

    @RequestMapping("/exportLearningExperience")
    @ResponseBody
    public  void exportLearningExperience(HttpServletRequest request, HttpServletResponse response,LearningExperienceWithBLOBs learningExperienceWithBLOBs){
        learningExperienceService.exportLearningExperience(request,response,learningExperienceWithBLOBs);
    }

    @RequestMapping("/importLearningExperience")
    @ResponseBody
    public  BaseWrapper importLearningExperience(MultipartFile file) throws IOException {
        return learningExperienceService.importLearningExperience(file);
    }

    @RequestMapping("/getHrCodes")
    @ResponseBody
    public  BaseWrapper getHrCodes(String type) {
        return learningExperienceService.getHrCodes(type);
    }
}
